package com.s2bdatautil;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

public class ReadWorkNoInfo {

	public static List<String> allFileList = new ArrayList<String>();

	public static void main(String[] args) throws Exception {
		File file = new File("D:\\桌面\\中外运\\HISTORY");
		readAllFiles(file);
		for (String path : allFileList) {
			try {
//			System.out.println(path);
				List<List<List<String>>> readdata = readExpressFromExcel(path);
				for (List<String> data : readdata.get(0)) {
					for (String onedata : data) {
						if (onedata != null && onedata.contains("715-0021-03")) {
							System.out.print(onedata + "  ");
							System.out.println(path);
						}
					}
//				System.out.println();
				}
//			System.out.println();
			} catch (Exception e) {
//				System.out.println(e.getMessage());
			}
		}

//		List<List<List<String>>> readdata = readExpressFromExcel("D:\\桌面\\ImportData\\20190210.xlsx");
	}

	public static void readAllFiles(File f) {
		if (f != null) {
			if (f.isDirectory()) {
				File[] fileArray = f.listFiles();
				if (fileArray != null) {
					for (int i = 0; i < fileArray.length; i++) {
						// 递归调用
						readAllFiles(fileArray[i]);
					}
				}
			} else {
				if (f.getAbsolutePath().endsWith(".xls") || f.getAbsolutePath().endsWith(".xlsx")) {
					allFileList.add(f.getAbsolutePath());
//					System.out.println(f.getAbsolutePath());
				}

			}
		}
	}

	private static List<List<List<String>>> readExpressFromExcel(String fileurl) throws Exception {
		List<List<List<String>>> list = ReadExcel.readXlsx(fileurl);

		return list;
	}

}
